home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 23 / CU Amiga - Super CD-ROM 23 (June 1998).iso / CreatingGames / Utilities / E / PsiloPlayer / Src / Modules / med / mmd.e next >
Encoding:
Text File  |  1995-11-23  |  10.6 KB  |  249 lines

  1.  
  2. OPT MODULE
  3.  
  4. /* This is the main module structure */
  5. EXPORT OBJECT mmd0      /* Also for MMD1 and MMD2 */
  6.     id:LONG                             /* "MMD0" or "MMD1" */
  7.     modlen:LONG                         /* module length (in bytes) */
  8.     song:PTR TO mmd0song                /* pointer to MMD0song */
  9.     psecnum:INT                         /* (MMD2) - used by the player */
  10.     pseq:INT                            /* (MMD2) - used by the player */
  11.     blockarr:PTR TO LONG                /* pointer to pointers of blocks */
  12.     reserved1:LONG
  13.     smplarr:PTR TO LONG                 /* pointer to pointers of samples */
  14.     reserved2:LONG
  15.     expdata:PTR TO mmd0exp              /* pointer to expansion data */
  16.     reserved3:LONG
  17. /* The following values are used by the play routine */
  18.     pstate:INT                          /* the state of the player */
  19.     pblock:INT                          /* current block */
  20.     pline:INT                           /* current line */
  21.     pseqnum:INT                         /* current # of playseqlist */
  22.     actplayline:INT                     /* OBSOLETE!! SET TO 0xFFFF! */
  23.     counter:CHAR                        /* delay between notes */
  24.     extra_songs:CHAR                    /* number of additional songs, see */
  25. ENDOBJECT                               /* expdata.nextmod */
  26.  
  27. /* These are the structures for future expansions */
  28.  
  29. EXPORT OBJECT instrext  /* This struct only for data required for playing */
  30. /* NOTE: THIS STRUCTURE MAY GROW IN THE FUTURE, TO GET THE CORRECT SIZE,
  31.    EXAMINE mmd0.expdata.s_ext_entrsz */
  32. /* ALSO NOTE: THIS STRUCTURE MAY BE SHORTER THAN DESCRIBED HERE,
  33.    EXAMINE mmd0.expdata.s_ext_entrsz */
  34.         hold:CHAR
  35.         decay:CHAR
  36.         suppress_midi_off:CHAR        /* 1 = suppress, 0 = don't */
  37.         finetune:CHAR
  38.         default_pitch:CHAR      /* (V5) */
  39.         instr_flags:CHAR        /* (V5) */
  40.         long_midi_preset:INT    /* (V5), overrides the preset in the
  41.                 song structure, if this exists, MMD0sample/midipreset
  42.                 should not be used. */
  43.         output_device:CHAR      /* (V5.02, V6) */
  44.         reserved:CHAR           /* currently unused */
  45. ENDOBJECT
  46.  
  47. /* Bits for instr_flags */
  48. EXPORT SET SSFLG_LOOP,SSFLG_EXTPSET,SSFLG_DISABLED
  49.  
  50. /* Currently defined output_device values */
  51. EXPORT ENUM OUTPUT_STD=0,OUTPUT_MD16,OUTPUT_TOCC
  52.  
  53. EXPORT OBJECT mmdinstrinfo
  54.         name[40]:ARRAY OF CHAR
  55.         pad0:CHAR
  56.         pad1:CHAR
  57. ENDOBJECT
  58.  
  59. EXPORT OBJECT mmd0exp
  60.         nextmod:PTR TO mmd0             /* for multi-modules */
  61.         exp_smp:PTR TO instrext         /* pointer to an array of InstrExts */
  62.         s_ext_entries:INT               /* # of InstrExts in the array */
  63.         s_ext_entrsz:INT                /* size of an InstrExt structure */
  64.         annotxt:PTR TO CHAR             /* 0-terminated message string */
  65.         annolen:LONG                    /* length (including the 0-byte) */
  66. /* MED V3.20 data below... */
  67.         iinfo:PTR TO mmdinstrinfo       /* "secondary" InstrExt for info
  68.                                            that does not affect output */
  69.         i_ext_entries:INT               /* # of MMDInstrInfos */
  70.         i_ext_entrsz:INT                /* size of one */
  71.         jumpmask:LONG                   /* OBSOLETE in current OctaMEDs */
  72.         rgbtable:PTR TO INT             /* pointer to 8 UWORD values,
  73.                                            ignored by OctaMED V5 and later */
  74.         channelsplit[4]:ARRAY OF CHAR   /* for OctaMED only (non-zero = NOT splitted) */
  75.         n_info:PTR TO notationinfo      /* OctaMED notation editor info data */
  76.         songname:PTR TO CHAR            /* song name */
  77.         songnamelen:LONG                /* length (including terminating zero) */
  78.         dumps:PTR TO mmddumpdata        /* MIDI message dump data */
  79.         mmdinfo:PTR TO mmdinfo          /* (V6) annotation information */
  80. /* These are still left, they must be 0 at the moment. */
  81.         reserved2[6]:ARRAY OF LONG
  82. ENDOBJECT
  83.  
  84. /* Info for each instrument (mmd0.song.sample[xx]) */
  85.  
  86. EXPORT OBJECT mmd0sample
  87.         rep:INT
  88.         replen:INT              /* repeat/repeat length */
  89.         midich:CHAR             /* midi channel for curr. instrument */
  90.         midipreset:CHAR         /* midi preset (1 - 128), 0 = no preset */
  91.         svol:CHAR               /* default volume */
  92.         strans:CHAR             /* sample transpose */
  93. ENDOBJECT
  94.  
  95. /* The song structure (mmd0.song) */
  96.  
  97. EXPORT OBJECT mmd0song
  98.         sample[63]:ARRAY OF mmd0sample  /* info for each instrument */
  99.         numblocks:INT                   /* number of blocks in this song */
  100.         songlen:INT                     /* number of playseq entries */
  101.         playseq[256]:ARRAY OF CHAR      /* the playseq list */
  102.         deftempo:INT                    /* default tempo */
  103.         playtransp:CHAR                 /* play transpose */
  104.         flags:CHAR                      /* flags (see below) */
  105.         reserved:CHAR                   /* for future expansion */
  106.         tempo2:CHAR                     /* 2ndary tempo (delay betw. notes) */
  107.         trkvol[16]:ARRAY OF CHAR        /* track volume */
  108.         mastervol:CHAR                  /* master volume */
  109.         numsamples:CHAR                 /* number of instruments */
  110. ENDOBJECT /* length = 788 bytes */
  111.  
  112. /* The new PlaySeq structure of MMD2 */
  113.  
  114. EXPORT OBJECT playseq
  115.         name[32]:ARRAY OF CHAR      /* (0)  31 chars + \0 */
  116.         reserved[2]:ARRAY OF LONG   /* (32) for possible extensions */
  117.         length:INT                  /* (40) # of entries */
  118. /* Commented out, not all compilers may like it... */
  119. /*      UWORD   seq[0]; */          /* (42) block numbers.. */
  120. /* Note: seq[] values above 0x7FFF are reserved for future expansion! */
  121. ENDOBJECT
  122.  
  123. /* This structure is used in MMD2s, instead of the above one. */
  124.  
  125. EXPORT OBJECT mmd2song
  126.         sample[63]:ARRAY OF mmd0sample
  127.         numblocks:INT
  128.         songlen:INT             /* NOTE: number of sections in MMD2 */
  129.         playseqtable:PTR TO LONG
  130.         sectiontable:INT        /* UWORD section numbers */
  131.         trackvols:PTR TO CHAR   /* UBYTE track volumes */
  132.         numtracks:INT           /* max. number of tracks in the song
  133.                                    (also the number of entries in
  134.                                     'trackvols' table) */
  135.         numpseqs:INT            /* number of PlaySeqs in 'playseqtable' */
  136.         pad0[240]:ARRAY OF CHAR /* reserved for future expansion */
  137. /* Below fields are MMD0/MMD1-compatible (except pad1[]) */
  138.         deftempo:INT
  139.         playtransp:CHAR
  140.         flags:CHAR
  141.         flags2:CHAR
  142.         tempo2:CHAR
  143.         pad1[16]:ARRAY OF CHAR  /* used to be trackvols, in MMD2 reserved */
  144.         mastervol:CHAR
  145.         numsamples:CHAR
  146. ENDOBJECT
  147.  
  148.  /* FLAGS of the above structure */
  149. EXPORT SET FLAG_FILTERON,    /* hardware low-pass filter */
  150.            FLAG_JUMPINGON,   /* OBSOLETE now, but retained for compatibility */
  151.            FLAG_JUMP8TH,     /* also OBSOLETE */
  152.            FLAG_INSTRSATT,   /* instruments are attached (sng+samples)
  153.                                 used only in saved MED-songs */
  154.            FLAG_VOLHEX,      /* volumes are represented as hex */
  155.            FLAG_STSLIDE,     /* no effects on 1st timing pulse (STS) */
  156.            FLAG_8CHANNEL,    /* OctaMED 8 channel song, examine this bit
  157.                                 to find out which routine to use */
  158.            FLAG_SLOWHQ       /* HQ slows playing speed (V2-V4 compatibility) */
  159. /* flags2 */
  160. EXPORT CONST FLAG2_BMASK=$1F,FLAG2_BPM=$20
  161.  
  162. EXPORT OBJECT mmddump
  163.         length:LONG             /* dump data length */
  164.         data:PTR TO CHAR        /* data pointer */
  165.         ext_len:INT             /* bytes remaining in this struct */
  166. /* ext_len >= 20: */
  167.         name[20]:ARRAY OF CHAR  /* message name (null-terminated) */
  168. ENDOBJECT
  169.  
  170. EXPORT OBJECT mmddumpdata
  171.         numdumps:INT             /* number of message dumps */
  172.         reserved[3]:ARRAY OF INT /* not currently used */
  173. ENDOBJECT   /* Followed by <numdumps> pointers to struct MMDDump */
  174.  
  175. /* Designed so that several info items can exist (in V6 only one supported),
  176.    you must also check the data type before using it, currently only text is
  177.    supported, but more types can be added in the future.
  178.  
  179.    Text is stored in plain Amiga ASCII, lines separated by \n characters.
  180.    The last byte is \0.
  181. */
  182. EXPORT OBJECT mmdinfo
  183.         next:PTR TO mmdinfo     /* next info (currently not supported) */
  184.         reserved:INT            /* 0 */
  185.         type:INT                /* 1 = text, ignore ALL other types */
  186.         length:LONG             /* length of the following data */
  187. /*      UBYTE   data[0]; */     /* Comments may be removed in SAS/C V6 */
  188. ENDOBJECT
  189.  
  190. /* flags in struct NotationInfo */
  191. EXPORT SET NFLG_FLAT,NFLG_3_4
  192.  
  193. EXPORT OBJECT notationinfo
  194.         n_of_sharps:CHAR        /* number of #'s (or b's) */
  195.         flags:CHAR              /* flags (see above) */
  196.         trksel[5]:ARRAY OF INT  /* selected track for each preset (-1 = none) */
  197.         trkshow[16]:ARRAY OF CHAR /* which tracks to show (bit 0 = for preset 0,
  198.                                      bit 1 for preset 1 and so on..) */
  199.         trkghost[16]:ARRAY OF CHAR /* ghosted tracks (like trkshow[]) */
  200.         notetr[64]:ARRAY OF CHAR   /* -24 - +24 (if bit #6 is negated, hidden) */
  201.         pad:CHAR        /* perhaps info about future extensions */
  202. ENDOBJECT
  203.  
  204. /* This structure exists in V6+ blocks with multiple command pages */
  205. EXPORT OBJECT blockcmdpagetable
  206.         num_pages:INT           /* number of command pages */
  207.         reserved:INT            /* zero = compatibility */
  208. /*      UWORD   *page[0];          page pointers follow... */
  209. ENDOBJECT
  210.  
  211. /* Below structs for MMD1 only! */
  212. EXPORT OBJECT blockinfo
  213.         hlmask:PTR TO LONG      /* highlight data */
  214.         blockname:PTR TO CHAR   /* block name */
  215.         blocknamelen:LONG       /* length of block name (including term. 0) */
  216.         pagetable:PTR TO blockcmdpagetable   /* (V6) command page table */
  217.         reserved[5]:ARRAY OF LONG /* future expansion */
  218. ENDOBJECT
  219.  
  220. EXPORT OBJECT mmd1block
  221.         numtracks:INT
  222.         lines:INT
  223.         info:PTR TO blockinfo
  224. ENDOBJECT
  225.  
  226. EXPORT CONST MMD1BLKHDRSZ=8
  227.  
  228. /* This header exists in the beginning of each sample */
  229. EXPORT OBJECT mmdsample
  230. /* length of one channel in bytes */
  231.         length:LONG
  232. /* see definitions below */
  233.         type:INT
  234. /* 8- or 16-bit data follows */
  235. ENDOBJECT
  236.  
  237. /* Type definitions: */
  238. EXPORT ENUM SAMPLE=0,IFF5OCT,IFF3OCT,IFF2OCT,IFF4OCT,IFF6OCT,
  239.             IFF7OCT,EXTSAMPLE
  240. EXPORT CONST SYNTHETIC=-1,HYBRID=-2
  241. /* 16-bit (flag), only type SAMPLE supported */
  242. EXPORT CONST S_16=$10
  243. /* stereo (flag) */
  244. EXPORT CONST STEREO=$20
  245. /* only supported while reading... V5 Aura sample */
  246. EXPORT CONST OBSOLETE_MD16=$18
  247.  
  248. /* Please refer to 'MMD.txt' for a complete description of MMD file format. */
  249.